Re: [GENERAL] Data type recommendation

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: [GENERAL] Data type recommendation
Дата
Msg-id l03130302b3cdbf9992a3@[147.233.159.109]
обсуждение исходный текст
Ответ на Data type recommendation  (Thomas Lim <englim@pc.jaring.my>)
Список pgsql-general
At 11:02 +0300 on 04/08/1999, Thomas Lim wrote:


> According to the user guide, it is mentioned that TEXT data type is
> recommended over CHAR or VARCHAR.  Does anyone know why?  I thought the
> access time for TEXT is slower.  Shouldn't CHAR be used for key fields?
> Is there some sort of overheads for CHAR or VARCHAR that TEXT is
> recommended?  Hope that someone has an answer to this recommendation.

Text and Varchar are represented in the same way, but Text is preferred
because it has no maximum limit (except, of course, the notorious tuple
size).

I don't know if this still holds in 6.5, though I think it is, but indeed,
fixed-size fields have a better access time than variable-length fields
(thus CHAR is better than TEXT), provided that they are in the beginning of
the tuple (that is, they don't come after any variable-length column).

However, they are space-wasteful. CHAR types take the same storage space,
with spaces added on the right, regardless of the fact that the actual data
is shorter.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



В списке pgsql-general по дате отправления:

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: [GENERAL] problems compiling scripts.I'm near suicide
Следующее
От: Howie
Дата:
Сообщение: Re: [GENERAL] Query buffer problem.